<html>
<head>
<script>
    function onBridgeReady(){
        try{
        WeixinJSBridge.invoke('getBrandWCPayRequest',
                <%-JSON.stringify(payargs)%>,
            function(res){
                if(res.err_msg == "get_brand_wcpay_request:ok" ) {

                    alert('支付成功');
                }else{
                    alert('支付失败');
                }
                //跳转到相应的页面
                //location.href = '<%= jump_url %>';
            }
        );
        }catch(e){
            alert(e);
        }
    }
    if (typeof WeixinJSBridge == "undefined"){
        if( document.addEventListener ){
            document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
        }else if (document.attachEvent){
            document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
            document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
        }
    }else{
        onBridgeReady();
    }


</script>
</head>
</html>